using UnityEngine;
using System.Collections;

[System.Serializable]
public class SidescrollMovementData
{
	#region  Acceleration
        public  float          	 	m_fAcceleration;        	// The acceleration that multiplies the input
        public  float          		m_fBrake ;        			// The acceleration that multiplies the input when brakeing
    #endregion
                               	
    #region  Speed
        public  float         		m_fSpeedHardMaxFast;   		// The max speed
        public  float 				m_fSpeedHardMaxSlow;		// The max speed when the input is at half
        public  float         		m_fSpeedMaxSofteningSpeed;  // Speed at whitch the sof max speed is reduced (increment is instantaneous)
    #endregion

    #region  Stabilizers          	
        public  float          	 	m_fStabilizersMin;     		
        public  float         		m_fStabilizersMax;   		
        public  float         		m_fFrictionExtra;  			// The realistic friction when exceeding the speed limit
    #endregion  
	
	#region Resistance
		public	float				m_fHitReductionCoef;		// A coefficient that will multiply the hit impacts received	
		public	float				m_fAntigravityCoef;			// A coefficient that will multiply the external accelerations	
	#endregion
	
    //---------------------------------------------------------------------------------------------------------
    //---------------------------------------------------------------------------------------------------------
	public void Blend (ref SidescrollMovementData _sOtherData, float _fBlendCoef)
	{
		m_fAcceleration				=	Maths.FloatBlend(m_fAcceleration			,_sOtherData.m_fAcceleration			, _fBlendCoef);       
		m_fBrake					= 	Maths.FloatBlend(m_fBrake					,_sOtherData.m_fBrake					, _fBlendCoef);        		
		m_fSpeedHardMaxFast			=	Maths.FloatBlend(m_fSpeedHardMaxFast		,_sOtherData.m_fSpeedHardMaxFast		, _fBlendCoef);    	
		m_fSpeedHardMaxSlow			=	Maths.FloatBlend(m_fSpeedHardMaxSlow		,_sOtherData.m_fSpeedHardMaxSlow		, _fBlendCoef); 	
		m_fSpeedMaxSofteningSpeed	=	Maths.FloatBlend(m_fSpeedMaxSofteningSpeed	,_sOtherData.m_fSpeedMaxSofteningSpeed	, _fBlendCoef);  
		m_fStabilizersMin			=	Maths.FloatBlend(m_fStabilizersMin			,_sOtherData.m_fStabilizersMin			, _fBlendCoef);      	
		m_fStabilizersMax			=	Maths.FloatBlend(m_fStabilizersMax			,_sOtherData.m_fStabilizersMax			, _fBlendCoef);
		m_fFrictionExtra			=	Maths.FloatBlend(m_fFrictionExtra			,_sOtherData.m_fFrictionExtra			, _fBlendCoef);
		m_fHitReductionCoef			=	Maths.FloatBlend(m_fHitReductionCoef		,_sOtherData.m_fHitReductionCoef	, m_fHitReductionCoef);
	}
	
    //---------------------------------------------------------------------------------------------------------
    //---------------------------------------------------------------------------------------------------------
	public void Set (ref SidescrollMovementData _sOtherData)
	{
		m_fAcceleration				=	_sOtherData.m_fAcceleration				;       
		m_fBrake					= 	_sOtherData.m_fBrake					;        		
		m_fSpeedHardMaxFast			=	_sOtherData.m_fSpeedHardMaxFast			;    	
		m_fSpeedHardMaxSlow			=	_sOtherData.m_fSpeedHardMaxSlow			; 	
		m_fSpeedMaxSofteningSpeed	=	_sOtherData.m_fSpeedMaxSofteningSpeed	;  
		m_fStabilizersMin			=	_sOtherData.m_fStabilizersMin			;      	
		m_fStabilizersMax			=	_sOtherData.m_fStabilizersMax			;
		m_fFrictionExtra			=	_sOtherData.m_fFrictionExtra			;
		m_fHitReductionCoef			=	_sOtherData.m_fHitReductionCoef			;
	}
}

